﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class EmployeeW
    {
        int employeeID;
        string employeeName;
        string deptID;
        string email;
        int userID;

        [DataMember]
        public int EmployeeID
        {
            get { return employeeID; }
            set { employeeID = value; }
        }

        [DataMember]
        public string EmployeeName
        {
            get { return employeeName; }
            set { employeeName = value; }
        }

        [DataMember]
        public string DeptID
        {
            get { return deptID; }
            set { deptID = value; }
        }

        [DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        [DataMember]
        public int UserID
        {
            get { return userID; }
            set { userID = value; }
        }

        public static EmployeeW convert(Employee employee)
        {
            EmployeeW u = new EmployeeW();

            u.EmployeeID = employee.EmployeeID;
            u.EmployeeName = employee.EmployeeName;
            u.DeptID = employee.DeptID;
            u.Email = employee.Email;
            u.UserID = employee.UserID.GetValueOrDefault();
            return u;
        }

        public static List<EmployeeW> convertList(List<Employee> list)
        {
            List<EmployeeW> listW = new List<EmployeeW>();

            foreach (Employee x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}